<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- 

      模块的数据会以模块名:对象的方式出现在$store的state中
      {
        msg: 'rootState中的数据',
        moduleA: {
          msg: 'moduleAState中的数据'
        }
      }
     -->
    {{$store.state.moduleA.msg}}
  </div>
  <script src="./vue.js"></script>
  <script src="./vuex.js"></script>
  <script>

    const store = new Vuex.Store({
      state: {
        msg: 'rootState中的数据'
      },
      getters: {
        rootGetter () {}
      },
      modules: {
        moduleA: {
          state: {
            msg: 'moduleAState中的数据'
          },
          getters: {
            moduleAGetter () {}
          }
        }
      }
    })


    const app = new Vue({
      el: '#app',
      store
    })
  
  </script>
</body>
</html>